package com.demo.mapper;

import com.demo.dto.SysUserDTO;
import com.demo.dto.UserDTO;
import com.demo.entity.SysUser;
import com.demo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户管理
 */
@Repository
public interface UserMapper {

    @Select("select * from users order by create_time desc ")
    List<User> findAllUsers();

    @Update("update users set disabled =#{disabled} where user_id =#{userId}")
    int updateUserState(String disabled,int userId);

    @Update("update users set password ='q123456' where user_id =#{userId}")
    int resetUser(int userId);

    @Delete("DELETE FROM users WHERE user_id=#{userId};")
    int deleteUser(int userId);
}